<div class="content_filtro">
        
    <div class="filtro">
        <form id="form_filtro" method="post" action="">
            <i>Filtrar</i>
            
            <?php

            $f_cur = $this->db->fetchAll('SELECT SQL_CACHE CBS_ID, CBS_NOM FROM CURSOBASE WHERE CBS_STA = 1 ORDER BY CBS_NOM');
            
            $html = '<select id="CBS_ID" name="CBS_ID" class="chosen-select" style="width: 170px !important;">';
            $html .= '<option value="">Todos Cursos</option>';
            foreach($f_cur as $r){   
                $select = $this->CBS_ID == $r['CBS_ID'] ? 'selected':'';
                $html .= '<option '.$select.' value="'.$r['CBS_ID'].'">'.$r['CBS_NOM'].'</option>';
            }
            $html .= '</select>';
            echo $html;
            ?>
            
            <?php
            
            $query = 'SELECT SQL_CACHE CUR_ID, CUR_NOM FROM CURSO WHERE CUR_STA = 1 and CUR_ANO >= '.date('Y');
            if($this->CBS_ID > 0) $query .= ' AND CBS_ID = '.$this->CBS_ID;
            $f_cur = $this->db->fetchAll($query);
            
            $html = '<span id="cb_turmas"><select id="CUR_ID" name="CUR_ID" class="chosen-select" style="width: 200px !important;" >';
            $html .= '<option value="">Todos Turmas</option>';
            foreach($f_cur as $r){   
                $select = $this->CUR_ID == $r['CUR_ID'] ? 'selected':'';
                $html .= '<option '.$select.' value="'.$r['CUR_ID'].'">'.dominio::getTurma($r['CUR_ID']).'</option>'; // $r['CUR_NOM'] 
            }
            $html .= '</select></span>';
            echo $html;
            ?>
            
            <?php 
            $html = '<span id="cb_alunos"><select id="ALU_ID" name="ALU_ID" class="chosen-select" style="width: 200px !important;" >';
            $html .= '<option value="">Todos Alunos</option>';
            foreach ($this->result as $r) {
                $select = $this->ALU_ID == $r['ALU_ID'] ? 'selected':'';
                $html .= '<option '.$select.' value="'.$r['ALU_ID'].'">'.$r['ALU_NOM'].'</option>'; // $r['CUR_NOM'] 
            }
            $html .= '</select></span>';
            echo $html;
            ?>

            <input type="submit" value="buscar" name="buscar" class="btn-pdr">
        </form>
    </div>
    
</div>   

<div class="content-form">
    <h2><?php echo $this->titulo; ?></h2>
    <div id="content-form">
        <div class="cnt-form">
            <div id="tabs">
                <ul>
                  <li><a href="#tabs-1">Por Questões</a></li>
                  <li><a href="#tabs-2">Por Alunos</a></li>
                  <li><a href="#tabs-3">Não Realizaram</a></li>
                </ul>
                <div id="tabs-1">
                    <table class="tab-rel">
                        <tr>
                            <th>Disciplina</th>
                            <?php if($this->buscar == ''){?>
                            <th class="center">Questão</th>
                            <?php }?>
                            <th class="center">Porcentagem</th>
                            <th class="center">Qtd. de Respostas</th>
                            <th class="center">Qtd. de Acertos</th>
                        </tr>
                <?php foreach($this->disc as $dis){?>
                        <tr>
                           <td><?php echo $dis['DCP_NOM'];?></td>
                           <?php if($this->buscar == ''){?>
                           <td class="center"><?php echo $dis['PQD_QST'];?></td>
                           <?php }?>
                           <td class="center"><?php echo $dis['PQD_POR'].'%';?></td>
                           <td class="center"><?php echo $dis['PQD_TOT'];?></td>
                           <td class="center"><?php echo $dis['PQD_ACR'];?></td>
                       </tr>
                <?php } ?>
                    </table>
                </div>
                <div id="tabs-2">
                    <table class="tab-rel">
                        <tr>
                            <th class="center">Ranking</th>
                            <th>Aluno</th>
                            <th class="center">Porcentagem</th>
                            <th class="center">Qtd. de Respostas</th>
                            <th class="center">Qtd. de Acertos</th>
                            <th>&nbsp;</th>
                        </tr>
                    <?php foreach($this->alunos as $alu){ ?>
                        <tr>
                            <td class="center"><?php echo $alu['PLA_POS'];?></td> 
                            <td><?php echo $alu['ALU_NOM'];?></td>
                            <td class="center"><?php echo $alu['PLA_POR'];?>%</td>
                            <td class="center"><?php echo $alu['PLA_TOT'];?></td>
                            <td class="center"><?php echo $alu['PLA_ACR'];?></td>
                            <td class="center">
                                <a target="_blank" class="btn-frm" href="<?php echo $this->urlbase.'/'.$this->modulo.'/aluno/boletimdesempenholista/id/'.$alu['ALU_ID'].'/op/list/pul_id/'.$alu['PUL_ID']; ?>">Lista</a>
                            </td>
                        </tr>
                    <?php } ?>
                    </table>
                </div>
                <div id="tabs-3">
                    <table class="tab-rel">
                        <tr>
                            <th>Aluno</th>
                        </tr>
                    <?php foreach($this->nad_alu as $alu){ ?>
                        <tr>
                            <td><?php echo $alu['ALU_NOM'];?></td>
                        </tr>
                    <?php } ?>
                    </table>
                </div>
            </div>
        </div>
    </div>    
</div>